package com.firword.common.constant;

import com.firword.common.domain.base.Combobox;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author: jingyajun
 * @date: 2020/9/27
 * @description:
 * @since:
 */
public enum SysDicTypeEnum {
    SEX("sex", "性别", 0),
    FILE_SYS("fileSys", "文件系统", 1);

    public static String getTypeName(String type) {
        SysDicTypeEnum[] values = SysDicTypeEnum.values();
        for (SysDicTypeEnum sysDicTypeEnum : values) {
            if (sysDicTypeEnum.type.equals(type)) {
                return sysDicTypeEnum.typeName;
            }
        }
        return "";
    }

    public static List<Combobox> comboboxList() {
        List<Combobox> list = new ArrayList<>();
        Combobox combobox = null;
        SysDicTypeEnum[] values = SysDicTypeEnum.values();
        for (SysDicTypeEnum sysDicTypeEnum : values) {
            combobox = new Combobox();
            combobox.setText(sysDicTypeEnum.typeName);
            combobox.setValue(sysDicTypeEnum.type);
            combobox.setOrder(sysDicTypeEnum.order);
            list.add(combobox);
        }
        Collections.sort(list);
        return list;
    }

    private String type;
    private String typeName;
    private Integer order;


    private SysDicTypeEnum(String type, String typeName, Integer order) {
        this.type = type;
        this.typeName = typeName;
        this.order = order;
    }
}
